<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" />
<title>Unbenanntes Dokument</title>
<usergroup>
0
</usergroup>
<usergroup_edit>40</usergroup_edit>
<menu_active>1</menu_active>
<title_active>1</title_active>
<template>script.html</template>
</head>

<body>
<?php
        
        
        
        require_once(config::$basePath."/system/api/simplehtmldom/simple_html_dom.php");  
        
        
        $tableName=trim($_REQUEST['table']);
		$fieldName=trim($_REQUEST['field']);
        
		$fieldType="";
		if (isset($_REQUEST['type']))
            {
            $fieldType=$_REQUEST['type'];
            }

        $required=false;
		if (isset($_REQUEST['required']))
            {
            $required=true;
            }

        $uniqueIndex=false;
        if (isset($_REQUEST['unique_index']))
            {
            $uniqueIndex=true;
            }

        $searchIndex=false;
        if (isset($_REQUEST['search_index']))
            {
            $searchIndex=true;
            }

        $index=false;
        

        
        
  $field = new xml_table_field();
  $field->tableName = $tableName;
  $field->fieldName = $fieldName;
  $field->fieldType = $fieldType;
  $field->required = $required;
  $field->searchIndex = $searchIndex;
  $field->uniqueIndex = $uniqueIndex;
  $field->addTableField();
  
  
        
        
        
        
       /* $xmlDatabase=new xml_database();
        $xmlDatabase->baseDir=false;
        $xmlDatabase->xmlFilename=config::$projectPath . "/db/db.xml";

        $xmlDatabase->addTableField($table, $field, $type, $required, $index, $uniqueIndex, $searchIndex);


        //echo $table;
        $xmlDatabase->writeXmlDatabaseFile(); */


        //$redirect = "/admin/db-verwaltung?table=$table";
        $redirect="/database-management?table=$tableName";
        http::redirect($redirect);
        ?>
</body>
</html>